#!/bin/bash

# 打包并将jar包复制到/e/Temp目录下，方便传输jar包

echo "services $*"

# 打包
echo "clean package"
mvn clean package -Dmaven.test.skip=true

function cpPart() {
  echo "cpPart $*"
  for s in "$@"
  do
    f_name="${s}.jar"
    full_f_name=$(find ./ -name "$f_name" | grep /target)
    if [ "full_f_name" != "" ]
    then
      echo "cp $full_f_name"
      cp -f "$full_f_name" /e/Temp/
    fi
  done
}

function cpAll() {
  echo "cpAll"
  cpPart "service-a" "service-b" "service-c" "service-d" "service-e"
}

# 复制
if [ $# -gt 0 ]
then
  cpPart "$@"
else
  cpAll
fi
